package com.dz.mapper;

import com.github.pagehelper.Page;
import com.dz.annotation.AutoFill;
import com.dz.dto.CategoryPageQueryDTO;
import com.dz.entity.Category;
import com.dz.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 鄧浩奇
 * @classname CategoryMapper
 * @description
 * @since 2023/12/16 21:40
 **/

@Mapper
public interface CategoryMapper {

    Page<Category> page(CategoryPageQueryDTO pageQueryDTO);

    @AutoFill(value = OperationType.INSERT)
    Integer insertCategory(Category category);

    Category selectByName(String name);

    @AutoFill(OperationType.UPDATE)
    Integer update(Category category);

    Integer changeStatus(@Param("id") Long id, @Param("status") Integer status);

    Integer removeCategory(Long id);

    List<Category> selectByType(Integer type);
}
